#-*- coding: utf8 -*-
from tutor.scripts import *
from tutor.plugins.maple import *

# variáveis úteis
half = M('1/2')
t = M.t
_i, _j, _k = M('_i, _j, _k')
rr = M('`..`')
coeff = M.coeff

n_iter = 0
while True:
    with display_block('Entradas'):
        a = M(oneof(1, 2, 3, 4))
        b = a + M(oneof(1, 2, 3, 4))
        k = M(oneof(2, 3, 4, 5))
        R = M(oneof(2, 3))
        h = b - a
        fieldF = (exp(z) * sin(x)) * _i + \
                     (-exp(z) * y * cos(x)) * _j + \
                     (M.sqrt(x ** 2 + y ** 2) * M.ln(k * z)) * _k
        kz = k * z

    with display_block('Resultados'):
        n_iter += 1
        fluxo = 2 * Pi * M.ln(b / a) * R ** 3 / 3
        jacobiano = R ** 2 * Pi * M.ln(b / a)
        limites = 2 * Pi * M.ln(b) * R ** 3 / 3
        derivadaLn = 2 * Pi * k * M.ln(b / a) * R ** 3 / 3
        distrator1 = Pi * M.ln(b / a)
        distrator2 = Pi * k * M.ln(b / a) * R ** 2


    if len(set([ fluxo, jacobiano, limites, derivadaLn, distrator1, distrator2 ])) != 6:
        continue
    else:
        break
